<?php

namespace iflow\native\Window\Service\Options;

use iflow\native\Window\Service\Options\Certificate\CertificateOptions;

class DialogOptions extends Options {

    /**
     * @description 对话框调用方法
     * @enum 'showOpenDialogSync', 'showOpenDialog', 'showSaveDialogSync', 'showSaveDialog', 'showMessageBoxSync', 'showMessageBox', 'showErrorBox', 'showCertificateTrustDialog'
     * @var string
     */
    protected string $dialogMethod;

    protected string $defaultPath;

    protected string $buttonLabel;

    /**
     * 指定一个文件类型数组，用于规定用户可见或可选的特定类型范围
     * @key name|extensions
     * @var array<string, string|string[]>
     */
    protected array $filters = [];

    /**
     * 包含对话框相关属性
     * @enum openDirectory, openFile, multiSelections, showHiddenFiles, createDirectory, promptToCreate, noResolveAliases,treatPackageAsDirectory, dontAddToRecent
     * @var string[]
     */
    protected array $properties;

    protected string $message;

    /**
     * @eunm none, info, error, question, warning
     * @var string
     */
    protected string $type;

    protected array $buttons;

    protected int $defaultId;

    protected string $detail;

    protected int $textWidth;

    protected int $cancelId;

    protected bool $noLink;

    protected bool $normalizeAccessKeys;

    protected CertificateOptions $certificate;

    protected bool $securityScopedBookmarks;


    public function toArray(array $options = []): array {
        $data = parent::toArray($options); // TODO: Change the autogenerated stub
        if (isset($data['certificate'])) $data['certificate'] = $this->certificate ?-> toArray() ?: $data['certificate'];

        return $data;
    }

}
